package com.haixee.parkdemo.gateway.security;

import com.haixee.parkdemo.common.entity.AuthData;
import com.haixee.parkdemo.gateway.client.AuthService;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.ReactiveUserDetailsService;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;
import reactor.core.publisher.Mono;

import java.util.ArrayList;

@Setter
public class UserDetailsServiceImpl implements ReactiveUserDetailsService {


    private PasswordEncoder passwordEncoder;

    private AuthService authService;

    @Override
    public Mono<UserDetails> findByUsername(String username) {

        SecurityUserDetails securityUserDetails = new SecurityUserDetails("user",
                passwordEncoder.encode("user"),
                true, true, true, true, new ArrayList<>(), new AuthData()
                );

        return Mono.just(securityUserDetails);
    }
}
